package com.yqg.manage.mapper;

import com.yqg.manage.entity.Department;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 部门 Mapper 接口
 * </p>
 *
 * @author zxf
 * @since 2025-09-16
 */
public interface DepartmentMapper extends BaseMapper<Department> {

    List<Department> rootPage(@Param("pageNum") Integer pageNum,
                              @Param("pageSize") Integer pageSize,
                              @Param("unitId") Long unitId);

    Integer rootPageCount(@Param("unitId") Long unitId);

    List<Department> childDepartment(@Param("id") Long id);

    /**
     * 删除前判断
     * @param departmentId 部门ID
     * @return 部门下用户条数
     */
    Integer deleteBeforeVerify(@Param("departmentId") Long departmentId);

    /**
     * 删除部门
     * @param departmentId 部门ID
     */
    void deleteDepartment(@Param("departmentId") Integer departmentId);

    List<Department> deputyDirectorRootPage(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize,
                                            @Param("userId") Long userId, @Param("unitId") Long unitId);

    Integer deputyDirectorRootPageCount(@Param("userId") Long userId, @Param("unitId") Long unitId);
}
